package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.gndy.*;
import com.tfswx.fljdmxyy.query.gndy.GndyQueryParam;
import com.tfswx.fljdmxyy.query.gndy.GndyQueryResult;
import com.tfswx.fljdmxyy.service.GndyService;
import com.tfswx.newbie.boot.starter.page.PageParam;
import com.tfswx.newbie.boot.starter.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 功能定义
 *
 * @author: 陈文佳
 * @date: 2022-10-13
 **/
@Slf4j
@RestController
@RequestMapping(value = "api/gndy")
@Api(tags = "功能定义")
public class GndyController {

    @Resource
    private GndyService gndyService;

    @ApiOperation("新增功能定义")
    @PostMapping(value = "/addGndy")
    public GndyAddOutputDTO addGndy(@RequestBody @Validated GndyAddInputDTO dto) {
        return gndyService.addGndy(dto);
    }

    @ApiOperation("修改功能定义")
    @PostMapping(value = "/updateGndy")
    public Boolean updateGndy(@RequestBody @Validated GndyUpdateInputDTO dto) {
        return gndyService.updateGndy(dto);
    }

    @ApiOperation("获取功能定义")
    @PostMapping(value = "/getGndy")
    public GndyGetOutputDTO getGndy(@RequestBody @Validated GndyGetInputDTO dto) {
        return gndyService.getGndy(dto);
    }

    @ApiOperation("删除功能定义")
    @PostMapping(value = "/deleteGndy")
    public Boolean deleteGndy(@RequestBody @Validated GndyDeleteInputDTO dto) {
        return gndyService.deleteGndy(dto);
    }

    @ApiOperation("获取列表功能定义")
    @PostMapping(value = "/queryGndy")
    public PageResult<GndyQueryResult> queryGndy(@RequestBody @Validated PageParam<GndyQueryParam> param) {
        return gndyService.queryGndy(param);
    }
}
